class Solution {
    vector<vector<int>> ret;
    vector<int> path;
    vector<int> vis;

public:
    void dfs(vector<int>& nums, int pos) {
        if (path.size() >= 2)
            ret.push_back(path);
        if (nums.size() <= pos)
            return;
        unordered_set<int> has;
        for(int i=pos;i<nums.size();i++)
        {
            if(has.count(nums[i]) || path.size()>0 && nums[i]<path.back())
                continue;
            has.insert(nums[i]);
            path.push_back(nums[i]);
            dfs(nums,i+1);
            path.pop_back();
        }
    }
    vector<vector<int>> findSubsequences(vector<int>& nums) {
        dfs(nums, 0);
        return ret;
    }
};
